package com.lazar.module1.subject2

import scala.util.Random
class Computer {
    var name: String = null
    var score = 0

  def InitRole(role: Int): Unit ={
     if (role == 1){
       name = "刘备"
     }else if (role == 2){
       name = "关羽"
     }else{
       name = "张飞"
     }
  }
  def showFist(): Int ={
     val n = Random.nextInt(2) + 1
    println(s"${name}出拳")

    if (n==1){
      println(s"${name}出拳：剪刀")
      n
    }else if (n == 2){
      println(s"${name}出拳：石头")
      n
    }else if (n  == 3){
      println(s"${name}出拳：布")
      n
    }else{
      printf("输入不符合规范，默认出布\n")
      3
    }

  }
}
